package com.eascs.overdue.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.eascs.common.util.UrlUtil;
import com.eascs.notice.controller.NoticeBaseMasterController;
import com.eascs.overdue.entity.O2oOverdueFormEntity;
import com.eascs.site.view.ViewContext;

@Controller
@RequestMapping("/overdueReport")
public class O2ooverdueReportController  extends NoticeBaseMasterController{

	@Value("${report.url}")
	private String reportUrl;

	@Value("${report.downExcel.url}")
	private String downExcelUrl;
	
	@RequestMapping("/index")
	public String index(O2oOverdueFormEntity entity){
		String o2ourl = "/overdueReport/o2o";
		if (entity != null) {
			String billCode = entity.getBillCode() == null ? "" : entity.getBillCode();
			String loanName = entity.getLoanName() == null ? "" : entity.getLoanName();
			String bankFun = entity.getBankFun() == null ? "" : entity.getBankFun();
			String province = entity.getProvince() == null ? "" : entity.getProvince();
			String status = entity.getStatus() == null ? "" : entity.getStatus();
			String regionalName = entity.getRegionalName() == null ? "" : entity.getRegionalName();
			o2ourl = UrlUtil.appendUrl(o2ourl.toString(), "billCode", billCode);
			o2ourl = UrlUtil.appendUrl(o2ourl, "loanName", loanName);
			o2ourl = UrlUtil.appendUrl(o2ourl, "bankFun", bankFun);
			o2ourl = UrlUtil.appendUrl(o2ourl, "province", province);
			o2ourl = UrlUtil.appendUrl(o2ourl, "status", status);
			o2ourl = UrlUtil.appendUrl(o2ourl, "regionalName", regionalName);
			o2ourl = o2ourl + "&pageIndex=";
		} else {
			o2ourl = o2ourl + "?pageIndex=";
		}
		ViewContext.put("o2ourl", o2ourl);
		//ViewContext.put("oaurl", oaurl);
		ViewContext.put("vo", entity);
		/*String excelUrl = reportUrl + downExcelUrl;
		ViewContext.put("downExcelUrl", excelUrl);
		ViewContext.put("downExcelUrl1", excelUrl + "1");*/
		return "overdue/index";
	}
	
}
